PLC Online Change
-
-
You have to save and compile your project before doing an online change.
This section provides a detailed description of the PLC"Programmable Logic Controller" A Programmable Logic Controller, PLC, or Programmable Controller is a digital computer used for automation of industrial processes, such as control of machinery on factory assembly lines. Used to synchronize the flow of inputs from (physical) sensors and events with the flow of outputs to actuators and events Online ChangeApplies to downloading PLC code changes while the applicaiton is running. functionality. See Using PLC Online Change for an overview of using this functionality.
What is Online Change
Online Change enables you to update your PLC application on the fly, while it is running on the controller. You do not need to stop the controller, download the new code and start again. You only need to modify, recompile and download the new code as shown in the figure below; and then ask the controller to switch the execution to the new application.
Figure 7-13: Online Change - Process Diagram
-
-
This capability applies only to PLC code. This is not supported in the PipeNetwork editor, the PLCOpen axis, or any other part of the system.
-
-
Depending on the PLC code size, the time to perform the Online Change operation can take more than one cycle. In that case, you can miss one PLC cycle before the changeover becomes effective.
This duration is also displayed in the Log window with an INFO level message as follows: Online Change done in X µs. For more details, click .
This feature is used in the following situations:
- Development phase: you can modify the application and apply these modifications incrementally without stopping the controller
- Update in production: you can update the running motion application (for instance with a bug fix release) without stopping the whole production chain
When Online Change is enabled, you can perform the following kinds of changes on the fly:
- Rename a program
- Change the code of a program
- Change the condition of an SFC"Sequential function chart" It can be used to program processes that can be split into steps. The main components of SFC are: - Steps with associated actions - Transitions with associated logic conditions - Directed links between steps and transitions transition or the actions of an SFC step (i.e.P1, N and P0)
- Create, rename or delete global and local variables
- Create, rename or delete global and local function block instances
- Rename Retain Variables
The following are not allowed:
- Create or delete a program
- Add or remove Custom Libraries
- Add new PLC axes, change or delete PLC axes
- Add new cam profiles, change or delete existing cam profiles
- Add new Pipe Network blocks, change or delete existing Pipe Network blocks
- Add or remove variables in a Structure
- Create a new Structure or a new UDFB"User Defined Function Block" UDFB can be used as a sub-function block in another program of the application. It is described using FBD, LD, ST or IL language. Input / output parameters of a UDFB (as well as private variables) are declared in the variable editor as local variables of the UDFB
- Change the local parameters and variables of a UDFB
- Change the type or dimension (or string length) of a variable or function block instance
- Create or delete Retain variables (their position in the runtimeIn computer science, runtime (or run-time) describes the operation of a computer program, the duration of its execution, from beginning to termination (compare compile time). Within KAS, runtime also refers to the virtual machine that manage the program written in a computer language while it is running cannot be re-allocated)
- Change SFC charts: you cannot add or remove steps in the First Level of an SFC chart (but you can modify existing steps)
- Change the set of Input/Output or any modification that leads to an update in the EtherCAT Motion Bus configuration
- PulseWhen the step gets activated, the action is activated for a single execution, and possibly once again when the step is deactivated (P or N) contacts and coils (edge detection)
-
-
Using Pulse contacts in FFLD does not give any error, but the behavior of the contact during the switch is not always safe (for more details, as well as workaround, Pulse Limitations with Online Change).
- The WAIT and WAIT_TIME instructions must not be used
-
-
The Online Change and Revert functions will fail while executing a WAIT.
- Loops in FBD"Function block diagram" A function block diagram describes a function between input variables and output variables. A function is described as a set of elementary blocks with no declared variable linked. In this case, you need to explicitly insert a variable in the loop.
-
-
When Online Change is active and custom libraries are being used, some errors can occur during the compilation. This happens if you open your project on another PC, or under a different user account in Windows. To fix this limitation:
- Deactivate the Online Change
- Save and then reopen the project
- Turn the Online Change back on if desired
- Deactivate the Online Change
-
-
Your new application can contain more variables than the previous one. A memory with sufficient pre-allocated space is defined for the eventual new variables. If you exceed this limit, a warning message is displayed.
For limitation about breakpoint with Online Change, see "About Online Change".
How to Activate Online Change
Figure 7-15: PLC Options - Online Change Enable
Set the parameters
This box allows you to enable or disable the Online Change feature (see call out ).
-
-
If you deactivate the Online Change, the next PLC application generated is no more compatible for an online change, even if you re-activated the online change before the compilation.
As a result, you can only apply an Online Change to a running application under the two following conditions:- The Online Change was already activated
- You have never deactivated the Online Change between the compilation of the running application and the compilation of the new application
- The Online Change was already activated
You also need to ensure that you have selected Normal code as Online Change is not possible with Optimized code. Note that when Optimized code is selected, then Online Change is always deactivated.
Then you can compile your application, which now allows future changes on the fly.
When you start the application, the Debug mode is automatically activated: you can see the values changing in the editors and the Dictionary (animation), showing what is happening on the controller. In this mode the editor is read-only, so you are not able to modify the code.
To edit your code, go out of the Debug mode and enter the Edit mode by clicking the button in the Main Toolbar.
Perform the Online Change
When your new code has compiled correctly, you can perform the Online Change. To do so, click the button. When you click this button, the KAS IDE"Integrated development environment" An integrated development environment is a type of computer software that assists computer programmers in developing software. IDEs normally consist of a source code editor, a compiler and/or interpreter, build-automation tools, and a debugger opens a window showing the execution of current actions (download, activation of new code).
Figure 7-16: Online Change - Updating Controller Version
Once the Online Change is applied, the result is displayed in the window and you can click OK to acknowledge the operation and do a Warm start.
Dictionary behavior
When the Online Change is enabled, the dictionary shows:
- new variables in blue
- deleted variables in red
Figure 7-17: Online Change - Dictionary
-
-
The deleted variables can be for new variables.
What is the Revert button
The Revert button is for security purposes. It allows you, after an Online Change, to revert your change quickly and go back to the previous application. That means switching the execution of the controller to the P-code that was running before the last Online Change (note that the source code in the KAS IDE is not replaced). The WAIT and WAIT_TIME instructions can not be used with Revert.
After the Revert, the KAS IDE automatically goes back to Edit mode and is disconnected from the controller. The user must manually reconnect to the controller.
-
-
You can go back to the previous version only when the Online Change feature is activated and while the controller is not stopped.
-
-
After a revert operation, the Online Change feature is deactivated.
Figure 7-18: One-click Recovery - Process Diagram
The Revert button is active when you are connected and the controller is running.
Revert is not possible:
- if you did not perform an Online Change
- if the controller has been restarted since the previous Online Change
- after another Revert
- during a WAIT
Difference between Local and Controller versions
When you restore a project with the Revert feature after an Online Change, KAS provides a tool to show the differences between two versions of the project. This tool can help you in checking all modifications before the next Online Change. It is also a useful tool when you want to compare your code with the last version after a Revert.
For more details, refer to Compare PLC Programs.